package com.xdb.logging;

public class NOPLoggerImpl implements Logger {

	private int infoCount;
	private int errorCount;
	private int warnCount;
	private int debugCount;
	private String loggerName;

	public NOPLoggerImpl(String loggerName) {
		this.loggerName = loggerName;
	}

	public String getLoggerName() {
		return this.loggerName;
	}

	public boolean isDebugEnabled() {
		return false;
	}

	public void error(Object s, Throwable e) {
		error(s);

		if (e != null) {
			e.printStackTrace();
		}
	}

	public void error(Object s) {
		errorCount++;
		if (s != null) {
			System.err.println(loggerName + "[ERROR] : " + s);
		}
	}

	public void debug(Object s) {
		debugCount++;
		if (s != null) {
			System.err.println(loggerName + "[DEBUG] : " + s);
		}
	}

	public void debug(Object s, Throwable e) {
		debugCount++;
		debug(s);
		if(e != null){
			e.printStackTrace();
		}
	}

	public void warn(Object s) {
		warnCount++;
		if (s != null) {
			System.out.println(loggerName + "[WARN] : " + s);
		}
	}

	@Override
	public void warn(Object s, Throwable e) {
		warnCount++;
		warn(s);
		if(e != null){
			e.printStackTrace();
		}
	}

	public int getErrorCount() {
		return errorCount;
	}

	@Override
	public int getWarnCount() {
		return warnCount;
	}

	@Override
	public void resetStat() {
		errorCount = 0;
		warnCount = 0;
		infoCount = 0;
		debugCount = 0;
	}

	@Override
	public boolean isInfoEnabled() {
		return false;
	}

	@Override
	public void info(Object s) {
		infoCount++;
		if (s != null) {
			System.out.println(loggerName + "[INFO] : " + s);
		}
	}

	@Override
	public boolean isWarnEnabled() {
		return false;
	}

	public int getInfoCount() {
		return infoCount;
	}

	public int getDebugCount() {
		return debugCount;
	}

}
